<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AdminMenus newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AdminMenus newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AdminMenus query()
 * @mixin \Eloquent
 */
class News extends Model
{
    protected $table = 'news';

    public $timestamps = false;


    public function getUpdateTimeAttribute($key)
    {
        return date('Y-m-d H:i:s', $key);
    }


//    public function setTable($table)
//    {
//        return parent::setTable($table); // TODO: Change the autogenerated stub
//    }

    /**
     * 创建表
     * @param $table
     */
    public static function CreateTable($table)
    {
        Schema::create($table, function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title', 255);
            $table->text('content');
            $table->string('index',255)->unique();
            $table->integer('update_time');
            $table->string('from', 255);
            $table->string('label', 500);
        });
    }
}
